<?php
	
	error_reporting(0);
	
	class Mailer {
		
		function Mailer(){
			
			include($_SERVER['DOCUMENT_ROOT'] . '/include/header.class.php');
			include($_SERVER['DOCUMENT_ROOT'] . '/include/parse.class.php');
			include($_SERVER['DOCUMENT_ROOT'] . '/include/menu.class.php'); 
			include($_SERVER['DOCUMENT_ROOT'] . '/include/db.class.php'); new Mysql;
		
		}
		
		function SendMail(){
		
			// Header System
            echo Header::CompileHeader('Contact Me!','Contact John, get a real reply from the man who\'s made this site and made all the products and tutorials to go with it!');
		
			if(isset($_POST['SendMail'])){
				
					Mysql::query("INSERT into mail (Name,Message,Email) VALUES ('".$_POST['name']."','".$_POST['message']."','".$_POST['email']."')", FALSE);
					echo '<h1>Email Sent!</h1>
					<span class="date">Email was sent successfully</span><p>Your email has been <strong>sent</strong>! I will try and write back to you as soon as i can.</p>';

					Mysql::close();

			} else {
				include($_SERVER['DOCUMENT_ROOT'] . '/template/mailer/mail.tpl');
			}
			
			// Menu System
			echo Menu::CallFunctions(array('Contact Me!'));
		}
	
	}
	
?>